{% macro gen_table(params, current_user, kwargs) %}
    <table id="param-table"
           class="table table-bordered table-hover table-condensed table-striped">
        <thead>
        <tr>
            <th>序号</th>
            <th>产品类型</th>
            <th>规格名称</th>
            <th>默认值</th>
            <th>单位</th>
            <th>计算项</th>
            <th>标签类型</th>
            <th>是否标题元素</th>
            <th>是否必填</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for param in params %}
            <tr>
                <td>{{ loop.index }}</td>
                <td>{{ param.product_type_name }}</td>
                <td>{{ param.name }}</td>
                <td>{{ param.default_value }}</td>
                <td>{{ param.unit_display }}</td>
                <td>{{ param.calculate_item_display }}</td>
                <td>{{ param.tag_type_display }}</td>
                <td>{{ param.is_title_display }}</td>
                <td>{{ param.required_display }}</td>
                <td>
                    <a
                            class="btn btn-xs btn-primary"
                            href="{{ url_for('product_bp.edit_param', param_id=param.id) }}"
                            name="user-info"
                            target="_self"
                    >编辑</a><br>
                    {% if current_user.is_authenticated %}
                        <a
                                class="btn btn-group btn-xs btn-danger"
                                href="{{ url_for('product_bp.ajax_delete_param', param_id=param.id, **kwargs) }}"
                                onclick="if(confirm('确认删除') == false) return false;"
                                name="user-info"
                                target="_self"
                        >删除</a>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endmacro %}
